How to masked the email ID column for make the securable Emails in table in SQL Server?
How to masked the email ID in SQL Server?
47914-Nov-2024
Updated on 03-Jan-2025
Home / DeveloperSection / Forums / How to masked the email ID in SQL Server?
How to masked the email ID column for make the securable Emails in table in SQL Server?
Khushi Singh
03-Jan-2025To mask an email ID in SQL Server, one can use the
STUFF
function to remove some characters, put*
on the result set, and put back some characters at the end.Example Query:
Explanation:
CHARINDEX('@', Email)
: Finds the position of the@
symbol in the email.STUFF
: Replaces the characters starting 3 characters before the@
with***
.Hope it helps!!